Allow use of grant tables for netdev tx+rx rings. Code is kinda
authorsmh22@firebug.cl.cam.ac.uk <smh22@firebug.cl.cam.ac.uk>
Sun, 14 Aug 2005 20:34:13 +0000 (20:34 +0000)
committersmh22@firebug.cl.cam.ac.uk <smh22@firebug.cl.cam.ac.uk>
Sun, 14 Aug 2005 20:34:13 +0000 (20:34 +0000)
ugly due at least in part to the fact that we still have separate
_TX and _RX grant config options - expect this to be unified soon.

Signed-off-by: Steven Hand <steven@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netback/common.h
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
tools/python/xen/lowlevel/xu/xu.c
tools/python/xen/xend/XendDomainInfo.py
tools/python/xen/xend/server/netif.py
xen/common/grant_table.c
xen/include/public/io/domain_controller.h

index a1f91465110bf3b32bf9c315b7b16ff10fbc63d1..c3c877ce6cb34efe1a5c37287a741741ff1d1794 100644 (file)
 #include <asm/io.h>
 #include <asm/pgalloc.h>
 
+#if defined(CONFIG_XEN_NETDEV_GRANT_TX) || defined(CONFIG_XEN_NETDEV_GRANT_RX)
+#include <asm-xen/xen-public/grant_table.h>
+#include <asm-xen/gnttab.h>
+#endif
+
+
+
 #if 0
 #define ASSERT(_p) \
     if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
@@ -40,7 +47,17 @@ typedef struct netif_st {
 
     /* Physical parameters of the comms window. */
     unsigned long    tx_shmem_frame;
+#ifdef CONFIG_XEN_NETDEV_GRANT_TX
+    u16              tx_shmem_handle;
+    memory_t         tx_shmem_vaddr; 
+    grant_ref_t      tx_shmem_ref; 
+#endif
     unsigned long    rx_shmem_frame;
+#ifdef CONFIG_XEN_NETDEV_GRANT_RX
+    u16              rx_shmem_handle;
+    memory_t         rx_shmem_vaddr; 
+    grant_ref_t      rx_shmem_ref; 
+#endif
     unsigned int     evtchn;
 
     /* The shared rings and indexes. */
index df0f43b3b203d16f07358f80baaa2b6c520af79c..acf5f80540af00a17a5dd466879f77478d85f143 100644 (file)
@@ -71,12 +71,31 @@ static void __netif_disconnect_complete(void *arg)
     netif_t              *netif = (netif_t *)arg;
     ctrl_msg_t            cmsg;
     netif_be_disconnect_t disc;
+#if defined(CONFIG_XEN_NETDEV_GRANT_RX) || defined(CONFIG_XEN_NETDEV_GRANT_TX)
+    struct gnttab_unmap_grant_ref op;
+#endif
 
     /*
      * These can't be done in netif_disconnect() because at that point there
      * may be outstanding requests in the network stack whose asynchronous
      * responses must still be notified to the remote driver.
      */
+
+#ifdef CONFIG_XEN_NETDEV_GRANT_TX
+    op.host_addr    = netif->tx_shmem_vaddr;
+    op.handle       = netif->tx_shmem_handle;
+    op.dev_bus_addr = 0;
+    BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
+#endif
+
+#ifdef CONFIG_XEN_NETDEV_GRANT_RX
+    op.host_addr    = netif->rx_shmem_vaddr;
+    op.handle       = netif->rx_shmem_handle;
+    op.dev_bus_addr = 0;
+    BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
+#endif
+
+
     vfree(netif->tx); /* Frees netif->rx as well. */
 
     /* Construct the deferred response message. */
@@ -275,37 +294,107 @@ void netif_connect(netif_be_connect_t *connect)
     unsigned long tx_shmem_frame = connect->tx_shmem_frame;
     unsigned long rx_shmem_frame = connect->rx_shmem_frame;
     struct vm_struct *vma;
-    pgprot_t      prot;
+#if !defined(CONFIG_XEN_NETDEV_GRANT_TX)||!defined(CONFIG_XEN_NETDEV_GRANT_RX)
+    pgprot_t      prot = __pgprot(_KERNPG_TABLE);
     int           error;
+#endif
     netif_t      *netif;
 
     netif = netif_find_by_handle(domid, handle);
-    if ( unlikely(netif == NULL) )
-    {
+    if ( unlikely(netif == NULL) ) {
         DPRINTK("netif_connect attempted for non-existent netif (%u,%u)\n", 
                 connect->domid, connect->netif_handle); 
         connect->status = NETIF_BE_STATUS_INTERFACE_NOT_FOUND;
         return;
     }
 
-    if ( netif->status != DISCONNECTED )
-    {
+    if ( netif->status != DISCONNECTED ) {
         connect->status = NETIF_BE_STATUS_INTERFACE_CONNECTED;
         return;
     }
 
-    if ( (vma = get_vm_area(2*PAGE_SIZE, VM_IOREMAP)) == NULL )
-    {
+    if ( (vma = get_vm_area(2*PAGE_SIZE, VM_IOREMAP)) == NULL ) {
         connect->status = NETIF_BE_STATUS_OUT_OF_MEMORY;
         return;
     }
 
-    prot = __pgprot(_KERNPG_TABLE);
-    error  = direct_remap_area_pages(&init_mm, 
-                                     VMALLOC_VMADDR(vma->addr),
-                                     tx_shmem_frame<<PAGE_SHIFT, PAGE_SIZE,
-                                     prot, domid);
-    error |= direct_remap_area_pages(&init_mm, 
+
+#if defined(CONFIG_XEN_NETDEV_GRANT_TX)
+    {
+        struct gnttab_map_grant_ref op;
+        int tx_ref = connect->tx_shmem_ref; 
+
+        /* Map: Use the Grant table reference */
+        op.host_addr = VMALLOC_VMADDR(vma->addr);
+        op.flags     = GNTMAP_host_map;
+        op.ref       = tx_ref;
+        op.dom       = domid;
+       
+        if ((HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1) < 0) || 
+            (op.handle < 0)) { 
+            DPRINTK(" Grant table operation failure !\n");
+            connect->status = NETIF_BE_STATUS_MAPPING_ERROR;
+            vfree(vma->addr);
+            return;
+        }
+
+        netif->tx_shmem_ref    = tx_ref;
+        netif->tx_shmem_handle = op.handle;
+        netif->tx_shmem_vaddr  = VMALLOC_VMADDR(vma->addr);
+    }
+        
+
+#else 
+    error = direct_remap_area_pages(&init_mm, 
+                                    VMALLOC_VMADDR(vma->addr),
+                                    tx_shmem_frame<<PAGE_SHIFT, PAGE_SIZE,
+                                    prot, domid); 
+    if ( error != 0 )
+    {
+        if ( error == -ENOMEM )
+            connect->status = NETIF_BE_STATUS_OUT_OF_MEMORY;
+        else if ( error == -EFAULT )
+            connect->status = NETIF_BE_STATUS_MAPPING_ERROR;
+        else
+            connect->status = NETIF_BE_STATUS_ERROR;
+        vfree(vma->addr);
+        return;
+    }
+#endif
+
+
+#if defined(CONFIG_XEN_NETDEV_GRANT_RX)
+    {
+        struct gnttab_map_grant_ref op;
+        int rx_ref = connect->rx_shmem_ref; 
+
+
+        /* Map: Use the Grant table reference */
+        op.host_addr = VMALLOC_VMADDR(vma->addr) + PAGE_SIZE;
+        op.flags     = GNTMAP_host_map;
+        op.ref       = rx_ref;
+        op.dom       = domid;
+
+        if ((HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1) < 0) || 
+            (op.handle < 0)) { 
+            DPRINTK(" Grant table operation failure !\n");
+            connect->status = NETIF_BE_STATUS_MAPPING_ERROR;
+            vfree(vma->addr);
+            return;
+        }
+
+            DPRINTK(" Grant table operation failure !\n");
+            connect->status = NETIF_BE_STATUS_MAPPING_ERROR;
+            vfree(vma->addr);
+            return;
+        }
+
+        netif->rx_shmem_ref    = rx_ref;
+        netif->rx_shmem_handle = handle;
+        netif->rx_shmem_vaddr  = VMALLOC_VMADDR(vma->addr) + PAGE_SIZE;
+    }
+#else 
+    error = direct_remap_area_pages(&init_mm, 
                                      VMALLOC_VMADDR(vma->addr) + PAGE_SIZE,
                                      rx_shmem_frame<<PAGE_SHIFT, PAGE_SIZE,
                                      prot, domid);
@@ -321,6 +410,8 @@ void netif_connect(netif_be_connect_t *connect)
         return;
     }
 
+#endif
+
     netif->evtchn         = evtchn;
     netif->tx_shmem_frame = tx_shmem_frame;
     netif->rx_shmem_frame = rx_shmem_frame;
index d2ede06e72cb9f47d604f77ea1c146d4999af12d..038b5e3e75230aad9455ae1d6bdf43438df2c2db 100644 (file)
@@ -518,7 +518,7 @@ inline static void net_tx_action_dealloc(void)
         gop++;
     }
     BUG_ON(HYPERVISOR_grant_table_op(
-        GNTTABOP_unmap_grant_ref, tx_unmap_ops, gop - tx_unmap_ops));
+               GNTTABOP_unmap_grant_ref, tx_unmap_ops, gop - tx_unmap_ops));
 #else
     mcl = tx_mcl;
     while ( dc != dp )
@@ -697,9 +697,9 @@ static void net_tx_action(unsigned long unused)
         skb_reserve(skb, 16);
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
         mop->host_addr = MMAP_VADDR(pending_idx);
-        mop->dom = netif->domid;
-        mop->ref = txreq.addr >> PAGE_SHIFT;
-        mop->flags = GNTMAP_host_map | GNTMAP_readonly;
+        mop->dom       = netif->domid;
+        mop->ref       = txreq.addr >> PAGE_SHIFT;
+        mop->flags     = GNTMAP_host_map | GNTMAP_readonly;
         mop++;
 #else
        MULTI_update_va_mapping_otherdomain(
@@ -752,7 +752,12 @@ static void net_tx_action(unsigned long unused)
 
         /* Check the remap error code. */
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-        if ( unlikely(mop->dev_bus_addr == 0) )
+        /* 
+           XXX SMH: error returns from grant operations are pretty poorly
+           specified/thought out, but the below at least conforms with 
+           what the rest of the code uses. 
+        */
+        if ( unlikely(mop->handle < 0) )
         {
             printk(KERN_ALERT "#### netback grant fails\n");
             make_tx_response(netif, txreq.id, NETIF_RSP_ERROR);
index b118313143ebd894fd7d23ad5b4894e2253ccfc2..dec8936e5aa04502515948288be377814d268d46 100644 (file)
@@ -59,7 +59,7 @@
 #include <asm-xen/gnttab.h>
 #ifdef GRANT_DEBUG
 static void
-dump_packet(int tag, u32 addr, u32 ap)
+dump_packet(int tag, void *addr, u32 ap)
 {
     unsigned char *p = (unsigned char *)ap;
     int i;
@@ -200,7 +200,7 @@ static char *be_state_name[] = {
     [BEST_CONNECTED]    = "connected",
 };
 
-#if DEBUG
+#ifdef DEBUG
 #define DPRINTK(fmt, args...) \
     printk(KERN_ALERT "xen_net (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
 #else
@@ -356,8 +356,12 @@ static void network_tx_buf_gc(struct net_device *dev)
             id  = np->tx->ring[MASK_NETIF_TX_IDX(i)].resp.id;
             skb = np->tx_skbs[id];
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-            if (gnttab_query_foreign_access(grant_tx_ref[id]) != 0) {
-                printk(KERN_ALERT "netfront: query foreign access\n");
+            if (unlikey(gnttab_query_foreign_access(grant_tx_ref[id]) != 0)) {
+                /* other domain is still using this grant - shouldn't happen
+                   but if it does, we'll try to reclaim the grant later */
+                printk(KERN_ALERT "network_tx_buf_gc: warning -- grant "
+                       "still in use by backend domain.\n");
+                goto out; 
             }
             gnttab_end_foreign_access(grant_tx_ref[id], GNTMAP_readonly);
             gnttab_release_grant_reference(&gref_tx_head, grant_tx_ref[id]);
@@ -382,6 +386,7 @@ static void network_tx_buf_gc(struct net_device *dev)
         mb();
     } while (prod != np->tx->resp_prod);
 
+  out: 
     if (np->tx_full && ((np->tx->req_prod - prod) < NETIF_TX_RING_SIZE)) {
         np->tx_full = 0;
         if (np->user_state == UST_OPEN)
@@ -433,13 +438,15 @@ static void network_alloc_rx_buffers(struct net_device *dev)
         
         np->rx->ring[MASK_NETIF_RX_IDX(req_prod + i)].req.id = id;
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
-        if ((ref = gnttab_claim_grant_reference(&gref_rx_head, gref_rx_terminal)) < 0) {
+        if (unlikely((ref = gnttab_claim_grant_reference(&gref_rx_head, 
+                                                gref_rx_terminal)) < 0)) {
             printk(KERN_ALERT "#### netfront can't claim rx reference\n");
             BUG();
         }
         grant_rx_ref[id] = ref;
         gnttab_grant_foreign_transfer_ref(ref, rdomid,
-        virt_to_machine(skb->head) >> PAGE_SHIFT);
+                                          virt_to_machine(
+                                              skb->head) >> PAGE_SHIFT);
         np->rx->ring[MASK_NETIF_RX_IDX(req_prod + i)].req.gref = ref;
 #endif
         rx_pfn_array[i] = virt_to_machine(skb->head) >> PAGE_SHIFT;
@@ -528,7 +535,8 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
     tx->id   = id;
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-    if ((ref = gnttab_claim_grant_reference(&gref_tx_head, gref_tx_terminal)) < 0) {
+    if (unlikely((ref = gnttab_claim_grant_reference(&gref_tx_head, 
+                                                     gref_tx_terminal)) < 0)) {
         printk(KERN_ALERT "#### netfront can't claim tx grant reference\n");
         BUG();
     }
@@ -638,7 +646,6 @@ static int netif_poll(struct net_device *dev, int *pbudget)
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
         ref = grant_rx_ref[rx->id];
         grant_rx_ref[rx->id] = GRANT_INVALID_REF;
-
         mfn = gnttab_end_foreign_transfer(ref);
         gnttab_release_grant_reference(&gref_rx_head, ref);
 #endif
@@ -674,18 +681,20 @@ static int netif_poll(struct net_device *dev, int *pbudget)
                                pfn_pte_ma(mfn, PAGE_KERNEL), 0);
 #else
        MULTI_update_va_mapping(mcl, (unsigned long)skb->head,
-                               pfn_pte_ma(rx->addr >> PAGE_SHIFT, PAGE_KERNEL), 0);
+                               pfn_pte_ma(rx->addr >> PAGE_SHIFT, 
+                                           PAGE_KERNEL), 0);
 #endif
         mcl++;
 
-        phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = 
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
-            mfn;
+        phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = mfn;
 #else
+        phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = 
             rx->addr >> PAGE_SHIFT;
 #endif
+
 #ifdef GRANT_DEBUG
-        printk(KERN_ALERT "#### rx_poll     enqueue vdata=%08x mfn=%08x ref=%04x\n",
+        printk(KERN_ALERT "#### rx_poll     enqueue vdata=%p mfn=%lu ref=%x\n",
                skb->data, mfn, ref);
 #endif
         __skb_queue_tail(&rxq, skb);
@@ -707,9 +716,9 @@ static int netif_poll(struct net_device *dev, int *pbudget)
 
     while ((skb = __skb_dequeue(&rxq)) != NULL) {
 #ifdef GRANT_DEBUG
-         printk(KERN_ALERT "#### rx_poll     dequeue vdata=%08x mfn=%08x\n",
-                skb->data, virt_to_machine(skb->data)>>PAGE_SHIFT);
-         dump_packet('d', skb->data, (unsigned long)skb->data);
+        printk(KERN_ALERT "#### rx_poll     dequeue vdata=%p mfn=%lu\n",
+               skb->data, virt_to_machine(skb->data)>>PAGE_SHIFT);
+        dump_packet('d', skb->data, (unsigned long)skb->data);
 #endif
         /*
          * Enough room in skbuff for the data we were passed? Also, Linux 
@@ -884,7 +893,7 @@ static void network_connect(struct net_device *dev,
 
 static void vif_show(struct net_private *np)
 {
-#if DEBUG
+#ifdef DEBUG
     if (np) {
         IPRINTK("<vif handle=%u %s(%s) evtchn=%u tx=%p rx=%p>\n",
                np->handle,
@@ -911,8 +920,29 @@ static void send_interface_connect(struct net_private *np)
 
     msg->handle = np->handle;
     msg->tx_shmem_frame = (virt_to_machine(np->tx) >> PAGE_SHIFT);
+#ifdef CONFIG_XEN_NETDEV_GRANT_TX
+    msg->tx_shmem_ref   = (u32)gnttab_claim_grant_reference(&gref_tx_head, 
+                                                            gref_tx_terminal);
+    if(msg->tx_shmem_ref < 0) { 
+        printk(KERN_ALERT "#### netfront can't claim tx_shmem reference\n");
+        BUG();
+    }
+    gnttab_grant_foreign_access_ref (msg->tx_shmem_ref, rdomid, 
+                                     msg->tx_shmem_frame, 0);
+#endif
+
     msg->rx_shmem_frame = (virt_to_machine(np->rx) >> PAGE_SHIFT);
-        
+#ifdef CONFIG_XEN_NETDEV_GRANT_RX
+    msg->rx_shmem_ref   = (u32)gnttab_claim_grant_reference(&gref_rx_head, 
+                                                            gref_rx_terminal);
+    if(msg->rx_shmem_ref < 0) {
+        printk(KERN_ALERT "#### netfront can't claim rx_shmem reference\n");
+        BUG();
+    }
+    gnttab_grant_foreign_access_ref (msg->rx_shmem_ref, rdomid, 
+                                     msg->rx_shmem_frame, 0);
+#endif
+
     ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
 }
 
@@ -1380,20 +1410,22 @@ static int __init netif_init(void)
     if (xen_start_info.flags & SIF_INITDOMAIN)
         return 0;
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-    if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE,
+    /* A grant for every ring slot, plus one for the ring itself */
+    if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE + 1,
                                       &gref_tx_head, &gref_tx_terminal) < 0) {
         printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n");
         return 1;
     }
-    printk(KERN_ALERT "#### netfront tx using grant tables\n");
+    printk(KERN_ALERT "Netdev frontend (TX) is using grant tables.\n"); 
 #endif
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
-    if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE,
+    /* A grant for every ring slot, plus one for the ring itself */
+    if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE + 1,
                                       &gref_rx_head, &gref_rx_terminal) < 0) {
         printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n");
         return 1;
     }
-    printk(KERN_ALERT "#### netfront rx using grant tables\n");
+    printk(KERN_ALERT "Netdev frontend (RX) is using grant tables.\n"); 
 #endif
 
     if ((err = xennet_proc_init()) != 0)
index f81dd722a4c6d73b236393df488c342c1dc608cb..832630e05708f147a4f3de41396263ea27001fbe 100644 (file)
@@ -655,7 +655,9 @@ static PyObject *xu_message_get_payload(PyObject *self, PyObject *args)
     case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_CONNECT):
         C2P(netif_fe_interface_connect_t, handle,         Int, Long);
         C2P(netif_fe_interface_connect_t, tx_shmem_frame, Int, Long);
+        C2P(netif_fe_interface_connect_t, tx_shmem_ref,   Int, Long);
         C2P(netif_fe_interface_connect_t, rx_shmem_frame, Int, Long);
+        C2P(netif_fe_interface_connect_t, rx_shmem_ref,   Int, Long);
         return dict;
     case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_DISCONNECT):
         C2P(netif_fe_interface_disconnect_t, handle, Int, Long);
@@ -681,7 +683,9 @@ static PyObject *xu_message_get_payload(PyObject *self, PyObject *args)
         C2P(netif_be_connect_t, domid,          Int, Long);
         C2P(netif_be_connect_t, netif_handle,   Int, Long);
         C2P(netif_be_connect_t, tx_shmem_frame, Int, Long);
+        C2P(netif_be_connect_t, tx_shmem_ref,   Int, Long);
         C2P(netif_be_connect_t, rx_shmem_frame, Int, Long);
+        C2P(netif_be_connect_t, rx_shmem_ref,   Int, Long);
         C2P(netif_be_connect_t, evtchn,         Int, Long);
         C2P(netif_be_connect_t, status,         Int, Long);
         return dict;
@@ -903,8 +907,10 @@ static PyObject *xu_message_new(PyObject *self, PyObject *args)
         P2C(netif_be_connect_t, domid,          u32);
         P2C(netif_be_connect_t, netif_handle,   u32);
         P2C(netif_be_connect_t, tx_shmem_frame, memory_t);
+        P2C(netif_be_connect_t, tx_shmem_ref,   u32); 
         P2C(netif_be_connect_t, rx_shmem_frame, memory_t);
-        P2C(netif_be_connect_t, evtchn,         u16);
+        P2C(netif_be_connect_t, rx_shmem_ref,   u32); 
+        P2C(netif_be_connect_t, evtchn,         u16); 
         break;
     case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DISCONNECT):
         P2C(netif_be_disconnect_t, domid,        u32);
index 029021f13e522c4d9d38b4f4578213d6a786efc6..5fe20c499a64e1313222fa41b888ce3c0e26b34e 100644 (file)
@@ -593,7 +593,7 @@ class XendDomainInfo:
     def delete(self):
         """Delete the vm's db.
         """
-        if self.dom_get(self.id):
+        if dom_get(self.id):
             return
         self.id = None
         self.saveToDB(sync=True)
index 9e42098f276943122df418a662699fa2082859d2..1163459ac08600b7e82671e8539f493cf375c7c2 100755 (executable)
@@ -421,7 +421,9 @@ class NetDev(Dev):
                         'netif_handle'   : self.vif,
                         'evtchn'         : self.getEventChannelBackend(),
                         'tx_shmem_frame' : val['tx_shmem_frame'],
-                        'rx_shmem_frame' : val['rx_shmem_frame'] })
+                        'tx_shmem_ref'   : val['tx_shmem_ref'],
+                        'rx_shmem_frame' : val['rx_shmem_frame'],
+                        'rx_shmem_ref'   : val['rx_shmem_ref'] })
         msg = self.backendChannel.requestResponse(msg)
         #todo: check return status
         self.status = NETIF_INTERFACE_STATUS_CONNECTED
index 785cfa97a0f807fafef7ed442899076a595d44b8..b6849a103f0a2a2c144267da590595b025d40185 100644 (file)
@@ -771,9 +771,8 @@ gnttab_dump_table(gnttab_dump_table_t *uop)
         if ( sha_copy.flags )
         {
             DPRINTK("Grant: dom (%hu) SHARED (%d) flags:(%hx) "
-                    "dom:(%hu) frame:(%lx)\n",
-                    op.dom, i, sha_copy.flags, sha_copy.domid, 
-                    (unsigned long) sha_copy.frame);
+                    "dom:(%hu) frame:(%x)\n",
+                    op.dom, i, sha_copy.flags, sha_copy.domid, sha_copy.frame);
         }
     }
 
@@ -826,8 +825,8 @@ gnttab_donate(gnttab_donate_t *uop, unsigned int count)
     for (i = 0; i < count; i++) {
         gnttab_donate_t *gop = &uop[i];
 #if GRANT_DEBUG
-        printk("gnttab_donate: i=%d mfn=%08x domid=%d gref=%08x\n",
-               i, (unsigned int)gop->mfn, gop->domid, gop->handle);
+        printk("gnttab_donate: i=%d mfn=%lx domid=%d gref=%08x\n",
+               i, gop->mfn, gop->domid, gop->handle);
 #endif
         page = &frame_table[gop->mfn];
 
@@ -1033,8 +1032,8 @@ gnttab_check_unmap(
 #if GRANT_DEBUG_VERBOSE
     if ( ld->domain_id != 0 )
     {
-        DPRINTK("Foreign unref rd(%d) ld(%d) frm(%x) flgs(%x).\n",
-                rd->domain_id, ld->domain_id, (unsigned int)frame, readonly);
+        DPRINTK("Foreign unref rd(%d) ld(%d) frm(%lx) flgs(%x).\n",
+                rd->domain_id, ld->domain_id, frame, readonly);
     }
 #endif
 
index 4df634c9d7ac941c38909e97db0d5080b23afdeb..1ff5f123cfa94baa1e3db76767d0e3b05caf6e11 100644 (file)
@@ -365,8 +365,10 @@ typedef struct netif_fe_driver_status {
  */
 typedef struct netif_fe_interface_connect {
     u32        handle;
-    memory_t   tx_shmem_frame;
+    memory_t   tx_shmem_frame; 
+    int        tx_shmem_ref;
     memory_t   rx_shmem_frame;
+    int        rx_shmem_ref;
 } netif_fe_interface_connect_t;
 
 /*
@@ -487,7 +489,9 @@ typedef struct netif_be_connect {
     domid_t    domid;          /* Domain attached to new interface.   */
     u32        netif_handle;   /* Domain-specific interface handle.   */
     memory_t   tx_shmem_frame; /* Page cont. tx shared comms window.  */
+    int        tx_shmem_ref;   /* Grant reference for above           */
     memory_t   rx_shmem_frame; /* Page cont. rx shared comms window.  */
+    int        rx_shmem_ref;   /* Grant reference for above           */
     u16        evtchn;         /* Event channel for notifications.    */
     /* OUT */
     u32        status;